package com.schoolET.service.wechat;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import com.schoolET.entity.Goods;
import com.schoolET.entity.GoodsType;
import com.schoolET.entity.dto.GoodsDTO;
import com.schoolET.entity.dto.GoodsInfoDTO;
import com.schoolET.entity.dto.GoodsTypeInfoDTO;
import com.schoolET.entity.vo.AddGoodsVO;
import org.springframework.web.multipart.MultipartFile;

import java.io.IOException;
import java.util.List;

/**
 * @author lin
 * @interfaceName GoodsService
 * @date 2024/6/6
 * @description 商品接口
 */
public interface GoodsService extends IService<Goods> {

    /**
     * @description: 通过id查询商品
     * @author: lin
     * @date: 2024/6/6 10:48
     * @param: id
     * @return: GoodsInfoDTO
     **/
    GoodsInfoDTO getGoodsById(Integer id);

    /**
     * @description: 根据id查询商品类型
     * @author: lin
     * @date: 2024/6/6 11:43
     * @param: id
     * @return: GoodsType
     **/
    GoodsType getGoodsTypeById(Integer id);

    /**
     * @description: 发布商品
     * @author: lin
     * @date: 2024/6/11 11:03
     * @param: addGoodsVO
     * @param: openId
     * @return: boolean
     **/
    boolean addGoods(AddGoodsVO addGoodsVO, String openId);


    /**
     * @description: 查询我购买得商品
     * @author: lin
     * @date: 2024/6/11 14:12
     * @param: openId
     * @param: pageNum
     * @param: pageSize
     * @return: Page<Goods>
     **/
    Page<Goods> getMyPurchaseGoods(String openId, Integer pageNum, Integer pageSize);

    /**
     * @description: 查询我发布的商品
     * @author: lin
     * @date: 2024/6/11 14:33
     * @param: openId
     * @param: pageNum
     * @param: pageSize
     * @return: Page<Goods>
     **/
    Page<Goods> getMySellGoods(String openId, Integer pageNum, Integer pageSize);

    /**
     * @description: 商品下架
     * @author: lin
     * @date: 2024/6/11 15:36
     * @param: goodsId
     * @param: openId
     * @return: boolean
     **/
    boolean takenShelves(Integer goodsId, String openId);

    /**
     * @description: 查找所有商品类型
     * @author: lin
     * @date: 2024/6/11 16:07
     * @return: GoodsTypeInfoDTO
     **/
    List<GoodsTypeInfoDTO> getGoodsTypeInfo();

    /**
     * @description: 查找商品
     * @author: lin
     * @date: 2024/6/11 16:31
     * @param: openId
     * @param: goodsTypeId
     * @param: theme
     * @param: pageNum
     * @param: pageSize
     * @return: Page<Goods>
     **/
    Page<Goods> getAllGoodsByTypeAndTheme(String openId, Integer goodsTypeId, String theme, Integer pageNum, Integer pageSize);

    List<GoodsDTO> getGoodsDTOPage(Integer pageNum, Integer pageSize);

    /**
     * @description: 上传商品图片
     * @author: lin
     * @date: 2024/6/18 15:20
     * @param: file
     * @return: String
     **/
    String putImage(MultipartFile file) throws IOException;
}
